package com.autorun.server.controller;

import com.autorun.server.config.SimpleWebSocketHandler;
import com.autorun.server.dto.ApiResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * WebSocket管理控制器
 * 
 * @author autorun
 * @version 1.0.0
 */
@RestController
@RequestMapping("/api/ws")
public class WebSocketController {

    /**
     * 获取WebSocket统计信息
     * 
     * @return 统计信息
     */
    @GetMapping("/stats")
    public ApiResponse<Map<String, Object>> getWebSocketStats() {
        Map<String, Object> stats = new HashMap<>();
        stats.put("online_count", SimpleWebSocketHandler.getOnlineCount());
        stats.put("message", "WebSocket统计信息");
        
        return ApiResponse.success(stats);
    }
}